package cloud.maque.admin.impl;

import cloud.maque.admin.domain.entity.MqUserLoginEquipment;
import cloud.maque.admin.mapper.MqUserLoginEquipmentMapper;
import cloud.maque.admin.service.MqUserLoginEquipmentService;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 4color
 * @description mq_user_login_equipment
 * @date 2023-03-17
 */
@Service
public class MqUserLoginEquipmentServiceImpl extends ServiceImpl<MqUserLoginEquipmentMapper, MqUserLoginEquipment> implements MqUserLoginEquipmentService {

    @Override
    public List<MqUserLoginEquipment> list(String userId) {
        QueryWrapper<MqUserLoginEquipment> wrapper = new QueryWrapper<>();
        if (!StrUtil.isEmptyIfStr(userId)) {
            wrapper.lambda().eq(MqUserLoginEquipment::getUserId, userId);
        }
        wrapper.lambda().orderByAsc(MqUserLoginEquipment::getCreateAt);
        List<MqUserLoginEquipment> lists = this.baseMapper.selectList(wrapper);
        return lists;
    }
}
